﻿<Window x:Class="Rubik.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Rubik's Cube" Height="600" Width="600" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <MeshGeometry3D x:Key="UnitCube"
                Positions="-0.5  0.5  0.5,  0.5  0.5  0.5,
                           -0.5 -0.5  0.5,  0.5 -0.5  0.5,
                            0.5  0.5 -0.5, -0.5  0.5 -0.5,
                            0.5 -0.5 -0.5, -0.5 -0.5 -0.5,
                           -0.5  0.5 -0.5, -0.5  0.5  0.5,
                           -0.5 -0.5 -0.5, -0.5 -0.5  0.5,
                            0.5  0.5  0.5,  0.5  0.5 -0.5,
                            0.5 -0.5  0.5,  0.5 -0.5 -0.5,
                           -0.5  0.5 -0.5,  0.5  0.5 -0.5,
                           -0.5  0.5  0.5,  0.5  0.5  0.5,
                            0.5 -0.5 -0.5, -0.5 -0.5 -0.5,
                            0.5 -0.5  0.5, -0.5 -0.5  0.5"

                TriangleIndices=" 0  2  1,  1  2  3
                                  4  6  5,  5  6  7,
                                  8 10  9,  9 10 11,
                                 12 14 13, 13 14 15
                                 16 18 17, 17 18 19
                                 20 22 21, 21 22 23"

                TextureCoordinates=
                    "0.000 0, 0.167 0, 0.000 1, 0.167 1,
                     0.167 0, 0.333 0, 0.167 1, 0.333 1,
                     0.333 0, 0.500 0, 0.333 1, 0.500 1,
                     0.500 0, 0.667 0, 0.500 1, 0.667 1,
                     0.667 0, 0.833 0, 0.667 1, 0.833 1,
                     0.833 0, 1.000 0, 0.833 1, 1.000 1" />

        <DiffuseMaterial x:Key="DMX0Y0Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y0Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid Background="Gray">
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid Background="Yellow">
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid Background="Blue">
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>
                            <Grid Background="Gray">
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid Background="Gray">
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid Background="DarkOrange">
                                <!-- Bottom side cube DarkOrange -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y0Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y0Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube DarkOrange -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y0Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y0Z0" Rows ="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube DarkOrange -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y0Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y0Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube Fuchsia -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y0Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y0Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube Fuchsia -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y0Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush  RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y0Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube Fuchsia -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y0Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y0Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y0Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y0Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y0Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y0Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="DarkOrange" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y1Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y1Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y1Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y1Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y1Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y1Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y1Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y1Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y1Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y1Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y1Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y1Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y1Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y1Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y1Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y1Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y2Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y2Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y2Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y2Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y2Z0">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y2Z0" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Yellow" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y2Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y2Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX1Y2Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y2Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y2Z1">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y2Z1" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX0Y2Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX0Y2Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Blue" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>



        <DiffuseMaterial x:Key="DMX1Y2Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX1Y2Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>

        <DiffuseMaterial x:Key="DMX2Y2Z2">
            <DiffuseMaterial.Brush>
                <VisualBrush RenderOptions.CachingHint="Cache">
                    <VisualBrush.Visual>
                        <UniformGrid Name="GNX2Y2Z2" Rows="1" Columns="6" Width="600" Height="100">
                            <Grid>
                                <!-- Front of the cube White -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="White" />
                            </Grid>
                            <Grid>
                                <!-- Back hand side of the cube Yellow -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                            <Grid>
                                <!-- Left hand side cube Blue -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>

                            <Grid>
                                <!-- Right side cube Green -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Green" />
                            </Grid>

                            <Grid>
                                <!-- Top side cube Red -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Red" />
                            </Grid>

                            <Grid>
                                <!-- Bottom side cube Cyan -->
                                <Rectangle Fill="Gray" Stroke="Black"/>
                                <Rectangle Margin="5" RadiusX="5" RadiusY="5" Fill="Gray" />
                            </Grid>
                        </UniformGrid>
                    </VisualBrush.Visual>
                </VisualBrush>
            </DiffuseMaterial.Brush>
        </DiffuseMaterial>


        <GeometryModel3D x:Key="ReCubeX0Y0Z0"  
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y0Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="-1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y0Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y0Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="-1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y0Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y0Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="-1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y0Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y0Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="-1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y0Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y0Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="-1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y0Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y0Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="-1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y0Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y0Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="-1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y0Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y0Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="-1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y0Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y0Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="-1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y1Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y1Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="0.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y1Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y1Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="0.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y1Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y1Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="0.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y1Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y1Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="0.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y1Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y1Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="0.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y1Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y1Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="0.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y1Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y1Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="0.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y1Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y1Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="0.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y2Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y2Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y2Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y2Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y2Z0" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y2Z0}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="1.0" OffsetZ="-1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y2Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y2Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y2Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y2Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y2Z1" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y2Z1}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="1.0" OffsetZ="0.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX0Y2Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX0Y2Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="-1.0"  OffsetY="1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX1Y2Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX1Y2Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="0.0"  OffsetY="1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>

        <GeometryModel3D x:Key="ReCubeX2Y2Z2" 
                         Geometry="{StaticResource UnitCube}"
                         Material="{StaticResource DMX2Y2Z2}">
            <GeometryModel3D.Transform>
                <TranslateTransform3D OffsetX="1.0"  OffsetY="1.0" OffsetZ="1.0" />
            </GeometryModel3D.Transform>
        </GeometryModel3D>



    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <DockPanel Grid.Column="0">
            <Grid>
                <Grid.Background>
                    <LinearGradientBrush>
                        <GradientStop Color="White" Offset="0"/>
                        <GradientStop Color="DarkKhaki" Offset=".3"/>
                        <GradientStop Color="DarkKhaki" Offset=".7"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Grid.Background>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0">
                        <Label FontSize="12" Margin="3,1,3,1">Rotation Axis</Label>
                        <ComboBox Name="AxisCB" SelectionChanged="OnAxisChange" Margin="3,1,3,1" MaxWidth="80" Width="80" SelectedIndex="0">
                            <ComboBoxItem>x-axis</ComboBoxItem>
                            <ComboBoxItem>y-axis</ComboBoxItem>
                            <ComboBoxItem>z-axis</ComboBoxItem>
                        </ComboBox>
                        <Label FontSize="12" Margin="3,1,3,1">Rotation Slice</Label>
                        <ComboBox Name="SliceCB" Margin="3,1,3,1" MaxWidth="80"  Width="80" SelectedIndex="0">
                            <ComboBoxItem>First</ComboBoxItem>
                            <ComboBoxItem>Second</ComboBoxItem>
                            <ComboBoxItem>Third</ComboBoxItem>
                            <ComboBoxItem>All</ComboBoxItem>
                        </ComboBox>
                        <Button Name="simpleButtonCW" Margin="10,3,10,3" Click="RotateClickCW">Rotate CW</Button>
                        <Button Name="simpleButtonCCW" Margin="10,3,10,3" Click="RotateClickCCW">Rotate CCW</Button>
                        <Button Name="simpleButtonShuffle" Margin="10,3,10,3" Click="RotateClickShuffle">Shuffle</Button>
                        <Button Name="simpleButtonUndo" Margin="10,3,10,3"  IsEnabled="False" Click="OnUndoClick">Undo</Button>
                        <Button Name="simpleButtonRedo" Margin="10,3,10,3" IsEnabled="False" Click="OnRedoClick">Redo</Button>
                    </StackPanel>
                    <StackPanel Grid.Row="1" VerticalAlignment="Bottom">
                        <CheckBox Name="CheckBtnLogFile" Margin="10,3,10,3"  Click="OnCheckLogFile">Log File</CheckBox>
                    </StackPanel>
                </Grid>
            </Grid>
        </DockPanel>
        <DockPanel Grid.Column="2">
            <TabControl>
                <TabItem Header="Front">
                    <DockPanel>
                        <ScrollBar Name="FrontHorz" DockPanel.Dock="Bottom" Orientation="Horizontal" Minimum="-180" Maximum="180" LargeChange="10" SmallChange="1" />
                        <ScrollBar Name="FrontVert" DockPanel.Dock="Right" Orientation="Vertical" Minimum="-180" Maximum="180" LargeChange="10" SmallChange="1" Width="17" />
                        <Viewport3D>
                            <ModelVisual3D x:Name="CUBEX0Y0Z0" Content="{StaticResource ReCubeX0Y0Z0}"/>
                            <ModelVisual3D x:Name="CUBEX1Y0Z0" Content="{StaticResource ReCubeX1Y0Z0}"/>
                            <ModelVisual3D x:Name="CUBEX2Y0Z0" Content="{StaticResource ReCubeX2Y0Z0}"/>
                            <ModelVisual3D x:Name="CUBEX0Y0Z1" Content="{StaticResource ReCubeX0Y0Z1}"/>
                            <ModelVisual3D x:Name="CUBEX1Y0Z1" Content="{StaticResource ReCubeX1Y0Z1}"/>
                            <ModelVisual3D x:Name="CUBEX2Y0Z1" Content="{StaticResource ReCubeX2Y0Z1}"/>
                            <ModelVisual3D x:Name="CUBEX0Y0Z2" Content="{StaticResource ReCubeX0Y0Z2}"/>
                            <ModelVisual3D x:Name="CUBEX1Y0Z2" Content="{StaticResource ReCubeX1Y0Z2}"/>
                            <ModelVisual3D x:Name="CUBEX2Y0Z2" Content="{StaticResource ReCubeX2Y0Z2}"/>
                            <ModelVisual3D x:Name="CUBEX0Y1Z0" Content="{StaticResource ReCubeX0Y1Z0}"/>
                            <ModelVisual3D x:Name="CUBEX1Y1Z0" Content="{StaticResource ReCubeX1Y1Z0}"/>
                            <ModelVisual3D x:Name="CUBEX2Y1Z0" Content="{StaticResource ReCubeX2Y1Z0}"/>
                            <ModelVisual3D x:Name="CUBEX0Y1Z1" Content="{StaticResource ReCubeX0Y1Z1}"/>
                            <ModelVisual3D x:Name="CUBEX2Y1Z1" Content="{StaticResource ReCubeX2Y1Z1}"/>
                            <ModelVisual3D x:Name="CUBEX0Y1Z2" Content="{StaticResource ReCubeX0Y1Z2}"/>
                            <ModelVisual3D x:Name="CUBEX1Y1Z2" Content="{StaticResource ReCubeX1Y1Z2}"/>
                            <ModelVisual3D x:Name="CUBEX2Y1Z2" Content="{StaticResource ReCubeX2Y1Z2}"/>
                            <ModelVisual3D x:Name="CUBEX0Y2Z0" Content="{StaticResource ReCubeX0Y2Z0}"/>
                            <ModelVisual3D x:Name="CUBEX1Y2Z0" Content="{StaticResource ReCubeX1Y2Z0}"/>
                            <ModelVisual3D x:Name="CUBEX2Y2Z0" Content="{StaticResource ReCubeX2Y2Z0}"/>
                            <ModelVisual3D x:Name="CUBEX0Y2Z1" Content="{StaticResource ReCubeX0Y2Z1}"/>
                            <ModelVisual3D x:Name="CUBEX1Y2Z1" Content="{StaticResource ReCubeX1Y2Z1}"/>
                            <ModelVisual3D x:Name="CUBEX2Y2Z1" Content="{StaticResource ReCubeX2Y2Z1}"/>
                            <ModelVisual3D x:Name="CUBEX0Y2Z2" Content="{StaticResource ReCubeX0Y2Z2}"/>
                            <ModelVisual3D x:Name="CUBEX1Y2Z2" Content="{StaticResource ReCubeX1Y2Z2}"/>
                            <ModelVisual3D x:Name="CUBEX2Y2Z2" Content="{StaticResource ReCubeX2Y2Z2}"/>

                            <!-- Light sources. -->
                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <Model3DGroup>
                                        <AmbientLight Color="White" />
                                        <DirectionalLight Color="White" Direction="2, -3 -1" />
                                    </Model3DGroup>
                                </ModelVisual3D.Content>
                            </ModelVisual3D>

                            <!-- Camera. -->
                            <Viewport3D.Camera>
                                <PerspectiveCamera Position="-6 6 4"
                               LookDirection="6 -6 -4"
                               UpDirection="0 1 0"
                               FieldOfView="60">
                                    <PerspectiveCamera.Transform>
                                        <Transform3DGroup>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="1,0,0" Angle="{Binding ElementName=FrontVert, Path=Value}" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="0,1,0" Angle="{Binding ElementName=FrontHorz, Path=Value}" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                        </Transform3DGroup>
                                    </PerspectiveCamera.Transform>
                                </PerspectiveCamera>
                            </Viewport3D.Camera>
                        </Viewport3D>
                    </DockPanel>
                </TabItem>
                <TabItem Header="Back">
                    <DockPanel>
                        <ScrollBar Name="BackHorz" DockPanel.Dock="Bottom" Orientation="Horizontal" Minimum="-180" Maximum="180" LargeChange="10" SmallChange="1" />
                        <ScrollBar Name="BackVert" DockPanel.Dock="Right" Orientation="Vertical" Minimum="-180" Maximum="180" LargeChange="10" SmallChange="1" Width="17" />
                        <Viewport3D>
                            <ModelVisual3D x:Name="BCUBEX0Y0Z0" Content="{StaticResource ReCubeX0Y0Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y0Z0" Content="{StaticResource ReCubeX1Y0Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y0Z0" Content="{StaticResource ReCubeX2Y0Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y0Z1" Content="{StaticResource ReCubeX0Y0Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y0Z1" Content="{StaticResource ReCubeX1Y0Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y0Z1" Content="{StaticResource ReCubeX2Y0Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y0Z2" Content="{StaticResource ReCubeX0Y0Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y0Z2" Content="{StaticResource ReCubeX1Y0Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y0Z2" Content="{StaticResource ReCubeX2Y0Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y1Z0" Content="{StaticResource ReCubeX0Y1Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y1Z0" Content="{StaticResource ReCubeX1Y1Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y1Z0" Content="{StaticResource ReCubeX2Y1Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y1Z1" Content="{StaticResource ReCubeX0Y1Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y1Z1" Content="{StaticResource ReCubeX2Y1Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y1Z2" Content="{StaticResource ReCubeX0Y1Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y1Z2" Content="{StaticResource ReCubeX1Y1Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y1Z2" Content="{StaticResource ReCubeX2Y1Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y2Z0" Content="{StaticResource ReCubeX0Y2Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y2Z0" Content="{StaticResource ReCubeX1Y2Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y2Z0" Content="{StaticResource ReCubeX2Y2Z0}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y2Z1" Content="{StaticResource ReCubeX0Y2Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y2Z1" Content="{StaticResource ReCubeX1Y2Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y2Z1" Content="{StaticResource ReCubeX2Y2Z1}"/>
                            <ModelVisual3D x:Name="BCUBEX0Y2Z2" Content="{StaticResource ReCubeX0Y2Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX1Y2Z2" Content="{StaticResource ReCubeX1Y2Z2}"/>
                            <ModelVisual3D x:Name="BCUBEX2Y2Z2" Content="{StaticResource ReCubeX2Y2Z2}"/>

                            <!-- Light sources. -->
                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <Model3DGroup>
                                        <AmbientLight Color="White" />
                                        <DirectionalLight Color="White" Direction="2, -3 -1" />
                                    </Model3DGroup>
                                </ModelVisual3D.Content>
                            </ModelVisual3D>

                            <!-- Camera. -->
                            <Viewport3D.Camera>
                             <!--
                                This depends how you would like to see it
                                <PerspectiveCamera Position="4 -6 -6"
                                LookDirection="-4 6 6" 
                                UpDirection="0 -1 0"
                                
                                -->
                               <PerspectiveCamera Position="6 -6 -4"
                               LookDirection="-6 6 4"
                               UpDirection="0 1 0"
                               FieldOfView="60">
                                    <PerspectiveCamera.Transform>
                                        <Transform3DGroup>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="1,0,0" Angle="{Binding ElementName=BackVert, Path=Value}" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="0,1,0" Angle="{Binding ElementName=BackHorz, Path=Value}" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                        </Transform3DGroup>
                                    </PerspectiveCamera.Transform>
                                </PerspectiveCamera>
                            </Viewport3D.Camera>
                        </Viewport3D>
                    </DockPanel>
                </TabItem>
            </TabControl>
        </DockPanel>
    </Grid>
</Window>
